package com.mc.read.adminapi.controller;

import com.mc.read.adminapi.service.UserService;
import com.mc.read.vo.request.BaseRequest;
import com.mc.read.vo.respose.BaseRespose;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author liuhao
 * @date 2019/6/12 15:18
 * 员工信息
 */
@Controller
@RequestMapping(value = "/verify/userinfo")
@Slf4j
public class UserController {

    @Autowired
    UserService userService;

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 员工列表展示 selectUserList
     **/
    @ResponseBody
    @RequestMapping(value = "selectUserList", method = RequestMethod.POST)
    public BaseRespose selectUserList(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.selectUserList(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 添加员工 addUser
     **/
    @ResponseBody
    @RequestMapping(value = "addUser", method = RequestMethod.POST)
    public BaseRespose addUser(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.addUser(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 修改员工信息 updateUserInfo
     **/
    @ResponseBody
    @RequestMapping(value = "updateUserInfo", method = RequestMethod.POST)
    public BaseRespose updateUserInfo(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.updateUserInfo(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 删除员工 deleteUser
     **/
    @ResponseBody
    @RequestMapping(value = "deleteUser", method = RequestMethod.POST)
    public BaseRespose deleteUser(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.deleteUser(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 查询员工角色 selectUserRole
     **/
    @ResponseBody
    @RequestMapping(value = "selectUserRole", method = RequestMethod.POST)
    public BaseRespose selectUserRole(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.selectUserRole(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 设置员工角色 updateUserRole
     **/
    @ResponseBody
    @RequestMapping(value = "updateUserRole", method = RequestMethod.POST)
    public BaseRespose updateUserRole(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.updateUserRole(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 修改密码 updateUserPsd
     **/
    @ResponseBody
    @RequestMapping(value = "updateUserPsd", method = RequestMethod.POST)
    public BaseRespose updateUserPsd(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.updateUserPsd(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 角色列表展示 selectRoleList
     **/
    @ResponseBody
    @RequestMapping(value = "selectRoleList", method = RequestMethod.POST)
    public BaseRespose selectRoleList(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.selectRoleList(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 添加角色 addRole
     **/
    @ResponseBody
    @RequestMapping(value = "addRole", method = RequestMethod.POST)
    public BaseRespose addRole(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.addRole(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 修改角色 updateRole
     **/
    @ResponseBody
    @RequestMapping(value = "updateRole", method = RequestMethod.POST)
    public BaseRespose updateRole(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.updateRole(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 删除角色 deleteRole
     **/
    @ResponseBody
    @RequestMapping(value = "deleteRole", method = RequestMethod.POST)
    public BaseRespose deleteRole(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.deleteRole(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 查询角色权限 selectRolePer
     **/
    @ResponseBody
    @RequestMapping(value = "selectRolePer", method = RequestMethod.POST)
    public BaseRespose selectRolePer(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.selectRolePer(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 设置角色权限 updateUserPer
     **/
    @ResponseBody
    @RequestMapping(value = "updateUserPer", method = RequestMethod.POST)
    public BaseRespose updateUserPer(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.updateUserPer(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 查询权限列表 selectPerList
     **/
    @ResponseBody
    @RequestMapping(value = "selectPerList", method = RequestMethod.POST)
    public BaseRespose selectPerList(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.selectPerList(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 查询权限详情 selectPerInfo
     **/
    @ResponseBody
    @RequestMapping(value = "selectPerInfo", method = RequestMethod.POST)
    public BaseRespose selectPerInfo(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.selectPerInfo(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 添加权限 addPer
     **/
    @ResponseBody
    @RequestMapping(value = "addPer", method = RequestMethod.POST)
    public BaseRespose addPer(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.addPer(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 修改权限 updatePer
     **/
    @ResponseBody
    @RequestMapping(value = "updatePer", method = RequestMethod.POST)
    public BaseRespose updatePer(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.updatePer(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 删除权限 deletePer
     **/
    @ResponseBody
    @RequestMapping(value = "deletePer", method = RequestMethod.POST)
    public BaseRespose deletePer(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.deletePer(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 员工个人中心 selectStaffInfo
     **/
    @ResponseBody
    @RequestMapping(value = "selectStaffInfo", method = RequestMethod.POST)
    public BaseRespose selectStaffInfo(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.selectStaffInfo(baseRequest);
        return baseRespose;
    }




}
